//
//  UIFont+Ext.swift
//  CocoProject
//
//  Created by Vill on 2023/11/3.
//

import Foundation

//MARK:-苹方自提
enum FontStyle {
    case medium // 中黑体
    case semibold // 中粗体
    case bold // 粗体
    case regular // 常规体
    case heavy
}

extension UIFont {
    
    static func pingfangFont(ofSize size: CGFloat, weight:FontStyle) -> UIFont {
        var fontName = "PingFangSC-Semibold"
        switch weight {
        case .bold:
            fontName = "PingFangSC-Bold"
        case .medium:
            fontName = "PingFangSC-Medium"
        case .semibold:
            fontName = "PingFangSC-Semibold"
        case .regular:
            fontName = "PingFangSC-Regular"
        case .heavy:
            fontName = "PingFangSC-Heavy"
        }
        return UIFont(name: fontName, size: PTW(Float(size))) ?? UIFont.systemFont(ofSize: PTW(Float(size)))
    }

}
